﻿Public Class Form2

    Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductsBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.ProductsBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.NorthwindDataSet)

    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'NorthwindDataSet.Customers' table. You can move, or remove it, as needed.
        Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet.Customers)
        'TODO: This line of code loads data into the 'NorthwindDataSet.Categories' table. You can move, or remove it, as needed.
        Me.CategoriesTableAdapter.Fill(Me.NorthwindDataSet.Categories)
        'TODO: This line of code loads data into the 'NorthwindDataSet.Products' table. You can move, or remove it, as needed.
        Me.ProductsTableAdapter.Fill(Me.NorthwindDataSet.Products)

        Dim ta As NorthwindDataSetTableAdapters.CategoryNamesTableAdapter = New NorthwindDataSetTableAdapters.CategoryNamesTableAdapter
        Dim dt As NorthwindDataSet.CategoryNamesDataTable = New NorthwindDataSet.CategoryNamesDataTable

        ta.Fill(dt)

        ComboBox2.DataSource = dt
        ComboBox2.DisplayMember = "CategoryName"
        ComboBox2.ValueMember = "CategoryId"



    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.ProductsTableAdapter.FillByProductName(Me.NorthwindDataSet.Products, "%" & TextBox1.Text & "%")
    End Sub

    Private Sub ComboBox1_SelectedValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
        Dim i As Integer = ComboBox1.SelectedValue
        Me.ProductsTableAdapter.FillByCategoryId(Me.NorthwindDataSet.Products, i)
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

        Dim i As Integer = ComboBox2.SelectedValue
        Me.ProductsTableAdapter.FillByCategoryId(Me.NorthwindDataSet.Products, i)

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.CustomersTableAdapter.FillByCompanyName(Me.NorthwindDataSet.Customers, "%" & TextBox2.Text & "%")
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

    End Sub

    Private Sub UnitPriceTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnitPriceTextBox.TextChanged

    End Sub
End Class